Skip to content

some features and improvements#3

Merged
winapiadmin merged 17 commits intotest_chesslibfrom
test_stablerel_thread1
Apr 25, 2026
Merged

some features and improvements#3
winapiadmin merged 17 commits intotest_chesslibfrom
test_stablerel_thread1

Conversation

@winapiadmin
Copy link
Copy Markdown
Owner

Passed STC:

--------------------------------------------------
Results of new vs base (10+0.1, NULL, 16MB, UHO_Lichess_4852_v1.epd):
Elo: 51.67 +/- 8.40, nElo: 92.31 +/- 14.79
LOS: 100.00 %, DrawRatio: 47.36 %, PairsRatio: 2.82
Games: 2120, Wins: 517, Losses: 204, Draws: 1399, Points: 1216.5 (57.38 %)
Ptnml(0-2): [8, 138, 502, 357, 55], WL/DD Ratio: 0.11
LLR: 2.95 (100.2%) (-2.94, 2.94) [0.00, 2.00]
--------------------------------------------------

Passed LTC:

--------------------------------------------------
Results of new vs base (60+0.6, NULL, 16MB, UHO_Lichess_4852_v1.epd):
Elo: 108.69 +/- 10.86, nElo: 199.39 +/- 18.67
LOS: 100.00 %, DrawRatio: 41.80 %, PairsRatio: 12.34
Games: 1330, Wins: 461, Losses: 58, Draws: 811, Points: 866.5 (65.15 %)
Ptnml(0-2): [1, 28, 278, 283, 75], WL/DD Ratio: 0.11
LLR: 2.95 (100.1%) (-2.94, 2.94) [0.00, 2.00]
--------------------------------------------------

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55b4b0e9a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread uci.cpp
}

searchThread = std::thread([ss = std::move(ss)]() mutable {
search::search(pos, parse_limits(ss));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Snapshot pos before launching the search thread

The worker is started with search::search(pos, ...), where pos is a mutable global also written by handlePosition(). Because loop() keeps accepting commands after go, a position ... command arriving before stop/join can mutate pos while the search thread is reading/copying it, which is a data race and can produce analysis for a mixed position. Capture a board snapshot before spawning the thread (or guard pos with synchronization).

Useful? React with 👍 / 👎.

Comment thread uci.cpp
Comment on lines +77 to +80
if (searchThread.joinable()) {
search::stop();
searchThread.join();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent TT option changes during asynchronous search

After go returns, the command loop can still process setoption; in this codebase, Hash/Clear Hash options in main.cpp call search::tt.resize()/clear(), while the worker thread simultaneously calls tt.lookup()/store() in search.cpp. This unsynchronized mutation can free or overwrite TT storage during search, causing crashes or corrupted results when options are changed mid-search. Gate mutating commands until the worker is joined, or protect TT with proper synchronization.

Useful? React with 👍 / 👎.

Comment thread uci.cpp Outdated
return limits;
}
void handleGo(std::istringstream &ss) { search::search(pos, parse_limits(ss)); }
std::thread searchThread;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Join searchThread when the input loop exits

The global std::thread is joined on go/stop/quit, but not when loop() ends via EOF. If stdin closes after a go command, searchThread can remain joinable, and destroying a joinable std::thread triggers std::terminate at shutdown (even if the worker already finished). Add a join on the EOF path or use a thread type with automatic joining semantics.

Useful? React with 👍 / 👎.

@winapiadmin winapiadmin merged commit 26e4720 into test_chesslib Apr 25, 2026
4 checks passed
@winapiadmin winapiadmin deleted the test_stablerel_thread1 branch April 25, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants